﻿@using ZX.Model
@{
    ViewBag.Title = "团队-指效OA";
}

<link href="~/dist/css/zui.lite.css" rel="stylesheet" />
<link href="~/dist/lib/chosen/chosen.min.css" rel="stylesheet" />
<script src="~/dist/lib/chosen/chosen.min.js"></script>
<script src="~/Scripts/layer/layer.js"></script>
<script src="~/Scripts/layer/layer.tools.js"></script>
<form method="post" class="form-horizontal" id="formProject_Block">
    <input type="hidden" name="Id" value="@Model.Id" />
    <input type="hidden" name="projectId" id="projectId" value="@ViewBag.ProjectId" />
    <input type="hidden" id="secondMenuId" name="secondMenuId" value="@ViewBag.SecondMenuId" />

    <div class="form-group" style="padding-top:16Px;">
        <label for="BType" class="col-sm-2">区块</label>
        <div class="col-md-6 col-sm-10">
            <select class="form-control" id="BType">
                <option value="team">任务列表</option>
                <option value="project">项目列表</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="BName" class="col-sm-2">

        </label>
        <div class="col-md-6 col-sm-10">
            <input type="text" id="BName" name="BName" value="@Model.BName" placeholder="区块名称" class="form-control" autocomplete="off" datatype="*">
        </div>
    </div>
    <div class="form-group">
        <label for="BColor" class="col-sm-2">外观</label>
        <div class="col-md-6 col-sm-10">
            <div class="input-group">
                <span class="input-group-addon">宽度</span>
                <select name="BWidth" id="BWidth" class="form-control">
                    <option value="33" data-keys="1/3">1/3</option>
                    <option value="50" data-keys="1/2">1/2</option>
                    <option value="66" data-keys="2/3">2/3</option>
                    <option value="25" data-keys="1/4">1/4</option>
                    <option value="75" data-keys="3/4">3/4</option>
                    <option value="100" data-keys="100%">100%</option>
                </select>
                <span class="input-group-addon ">颜色</span>
                <input type="text" id="BColor" name="BColor" value="@Model.BColor" class="form-control fix-border fix-padding" placeholder="颜色">
            </div>
        </div>
    </div>
    <div id="div_PTType" class="form-group">
        <label for="PTType" class="col-sm-2">
            类型
        </label>
        <div class="col-md-6 col-sm-10">
            <select name="PTType" id="PTType" class="form-control">
                <option value="1">指派给我</option>
                <option value="2">由我创建</option>
                <option value="3">由我完成</option>
                <option value="4">由我关闭</option>
                <option value="5">由我取消</option>
            </select>
            <select name="params[type]" id="paramstype" class="form-control chosen" style="display: none;">
                <option value="assignedTo" data-keys="zhipaigeiwo zpgw">指派给我</option>
                <option value="createdBy" data-keys="youwochuangjian ywcj">由我创建</option>
                <option value="finishedBy" data-keys="youwowancheng ywwc">由我完成</option>
                <option value="closedBy" data-keys="youwoguanbi ywgb">由我关闭</option>
                <option value="canceledBy" data-keys="youwoquxiao ywqx">由我取消</option>
            </select>
        </div>
    </div>
    <div id="div_PState" class="form-group" style="display:none">
        <label for="PState" class="col-sm-2">
            状态
        </label>
        <div class="col-md-6 col-sm-10">
            <select name="PState" id="PState" class="form-control">
                <option value="involved">我参与的</option>
                <option value="doing">进行中</option>
                <option value="finished">已完成</option>
                <option value="suspend">已挂起</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="RowCounts" class="col-sm-2">
            数量
        </label>
        <div class="col-md-6 col-sm-10">
            <input type="text" id="RowCounts" name="RowCounts" class="form-control" value="@Model.RowCounts" placeholder="数量">
        </div>
    </div>
    <div id="div_TBOrderBy" class="form-group">
        <label for="TBOrderBy" class="col-sm-2">
            排序
        </label>
        <div class="col-md-6 col-sm-10">
            <select name="TBOrderBy" id="TBOrderBy" class="form-control">
                <option value="id_asc">ID 递增</option>
                <option value="id_desc">ID 递减</option>
                <option value="pri_asc">优先级递增</option>
                <option value="pri_desc">优先级递减</option>
                <option value="deadline_asc">截止日期递增</option>
                <option value="deadline_desc">截止日期递减</option>
            </select>
        </div>
    </div>
    <div id="div_PBOrderBy" class="form-group">
        <label for="PBOrderBy" class="col-sm-2">
            排序
        </label>
        <div class="col-md-6 col-sm-10">
            <select name="PBOrderBy" id="PBOrderBy" class="form-control">
                <option value="createdDate_asc">创建时间递增</option>
                <option value="createdDate_desc">创建时间递减</option>
                <option value="begin_asc">开始时间递增</option>
                <option value="begin_desc">开始时间递减</option>
                <option value="end_asc">结束时间递增</option>
                <option value="end_desc">结束时间递减</option>
            </select>
        </div>
    </div>
    <div id="div_PTState" class="form-group">
        <label for="PTState" class="col-sm-2">
            任务状态
        </label>
        <input type="hidden" id="PTState" name="PTState" class="form-control" value="@Model.PTState" placeholder="任务状态">
        <div class="col-md-6 col-sm-10">
            <select data-placeholder="选择状态..." class="chosen-select form-control" tabindex="2" multiple="">
                <option value="1" data-keys="weiwancheng wwc">未完成</option>
                <option value="2" data-keys="weikaishi wks">未开始</option>
                <option value="3" data-keys="jinxingzhong jxz">进行中</option>
                <option value="4" data-keys="yiwancheng ywc">已完成</option>
                <option value="5" data-keys="yiquxiao yqx">已取消</option>
                <option value="6" data-keys="yiguanbi ygb">已关闭</option>
            </select>
        </div>
    </div>
    @Html.Raw(ViewBag.CurrentBtnList29)
    

</form>


<script type="text/javascript">

    $('select.chosen-select').chosen({
        no_results_text: '没有找到',    // 当检索时没有找到匹配项时显示的提示文本
        disable_search_threshold: 10, // 10 个以下的选择项则不显示检索框
        search_contains: true         // 从任意位置开始检索
    });

    $('select.chosen-select').on('change', function () {
        // 用户改变了选择
        $("#PTState").val($(this).val());

    });

    $('select.chosen-select')

    //$('[data-toggle="popover"]').popover();
    function SaveDate() {
        var item = { BType: -1, BName: "", BWidth: "", BColor: "", PTType: "", BOrderBy: "", RowCounts: 0, PTState: "" };
        //判断区块类型,并给相应的值
        if ($("#BType").val() == "team") {
            item.BType = 1;
            item.PTType = $("#PTType").val();
            item.BOrderBy = $("#TBOrderBy").val();
            item.PTState = $("#PTState").val();

        } else {
            item.BType = 2;
            item.BOrderBy = $("#PBOrderBy").val();
            item.PTState = $("#PState").val();
        }
        item.BName = $("#BName").val();
        item.BWidth = $("#BWidth").val();
        item.BColor = $("#BColor").val();
        item.RowCounts = $("#RowCounts").val();

        var jsonData = JSON.stringify(item);
        $.post("/Project_Block/SaveData", { jsonData: jsonData,secondMenuId: $("#secondMenuId").val()}, function (data) {
            if (data.Code = 200) {
                var myMessager = new $.zui.Messager('提示消息：保存成功', {
                    type: 'success', // 定义颜色主题
                    time: 0 // 不进行自动隐藏
                }).show();
                // 5 秒之后隐藏消息
                setTimeout(function () {
                    myMessager.hide();
                    win.close();
                    //window.location.href = "/Project/ProjectMain?mid=" + $("#aMid").val();
                }, 2000);
            } else {
                new $.zui.Messager('提示消息：保存失败', {
                    type: 'primary' // 定义颜色主题
                }).show();
            }
        });
    }
</script>